﻿<inter:PluginConfigForm x:Class="Convertor.Plugin.GenerateSequence.ConfigForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:inter="clr-namespace:Convertor.Interface;assembly=Convertor.Interface"
             xmlns:sm="clr-namespace:Wpf.CommonTools.SystemExtension;assembly=Wpf.CommonTools"
             xmlns:local="clr-namespace:Convertor.Plugin.GenerateSequence"
             mc:Ignorable="d" 
             Loaded="UserControl_Loaded_1">
    <inter:PluginConfigForm.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Convertor;component\Assets\Style.xaml"/>
                <ResourceDictionary Source="Assets\Lang\StringResource.zh.xaml"/>
                <ResourceDictionary Source="Assets\Lang\StringResource.en.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </inter:PluginConfigForm.Resources>
    <DockPanel MinWidth="600" MaxWidth="600" DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type inter:PluginConfigForm}}, Path=Config}">
        <AdornerDecorator DockPanel.Dock="Top">
            <TextBox x:Name="tbTemplateText" MaxWidth="600">
                <TextBox.Text>
                    <Binding Path="TemplateText" UpdateSourceTrigger="PropertyChanged">
                        <Binding.ValidationRules>
                            <local:TemplateTextRule/>
                        </Binding.ValidationRules>
                    </Binding>
                </TextBox.Text>
                <sm:WatermarkService.Titlemark>
                    <TextBlock Text="{DynamicResource Plugin_GenerateSequence_TemplateText}" TextAlignment="Right"></TextBlock>
                </sm:WatermarkService.Titlemark>
            </TextBox>
        </AdornerDecorator>
        <DockPanel DockPanel.Dock="Top">
            <AdornerDecorator DockPanel.Dock="Right" Width="140">
                <TextBox x:Name="tbPaddingLeftNumber" 
                         Text="{Binding Path=PaddingLeftNumber, UpdateSourceTrigger=PropertyChanged}">
                    <sm:WatermarkService.Titlemark>
                        <TextBlock Text="{DynamicResource Plugin_GenerateSequence_PaddingLeftNumber}" TextAlignment="Right"></TextBlock>
                    </sm:WatermarkService.Titlemark>
                </TextBox>
            </AdornerDecorator>
            <Grid DockPanel.Dock="Left" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition></ColumnDefinition>
                    <ColumnDefinition></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <AdornerDecorator Grid.Column="0">
                    <TextBox x:Name="tbStartNumber" 
                             Text="{Binding Path=StartNumber, UpdateSourceTrigger=PropertyChanged}">
                        <sm:WatermarkService.Titlemark>
                            <TextBlock Text="{DynamicResource Plugin_GenerateSequence_StartNumber}" TextAlignment="Right"></TextBlock>
                        </sm:WatermarkService.Titlemark>
                    </TextBox>
                </AdornerDecorator>
                <AdornerDecorator  Grid.Column="1">
                    <TextBox x:Name="tbStopNumber" 
                             Text="{Binding Path=StopNumber, UpdateSourceTrigger=PropertyChanged}">
                        <sm:WatermarkService.Titlemark>
                            <TextBlock Text="{DynamicResource Plugin_GenerateSequence_StopNumber}" TextAlignment="Right"></TextBlock>
                        </sm:WatermarkService.Titlemark>
                    </TextBox>
                </AdornerDecorator>
            </Grid>
        </DockPanel>
        <TextBlock Style="{StaticResource InfoStyle}" DockPanel.Dock="Top" Text="{Binding Path=ToolTip}"/>
    </DockPanel>
</inter:PluginConfigForm>
